<?php declare(strict_types=1);
namespace Unit\Core\Http;

use PHPUnit\Framework\Attributes\Test,
    PHPUnit\Framework\Attributes\DataProvider;
class ResponseTest extends \PHPUnit\Framework\TestCase
{
    #[Test]
    public function responseHasAsArrayMethod() {
        $response = new \Umserv\ExchangeInterfaces\V1\Core\Http\Response();
        $this->assertTrue(method_exists($response, 'getAsArray'));

    }

    #[Test]
    public function responseHasAsJsonMethod() {
        $response = new \Umserv\ExchangeInterfaces\V1\Core\Http\Response();
        $this->assertTrue(method_exists($response, 'getAsJson'));
    }

    #[Test]
    public function returnAsJson() {
        $response = new \Umserv\ExchangeInterfaces\V1\Core\Http\Response();
        $result = $response->getAsJson();
        $this->assertJsonStringEqualsJsonString(
            $result,
            json_encode(['response' => [], 'error' => null])
        );
    }

    #[Test]
    public function returnAsArray() {
        $response = new \Umserv\ExchangeInterfaces\V1\Core\Http\Response();
        $result = $response->getAsArray();
        $this->assertIsArray($result);
    }

    #[Test]
    public function responseHasDataProperty() {
        $response = new \Umserv\ExchangeInterfaces\V1\Core\Http\Response();
        $this->assertObjectHasProperty('data', $response);
    }

    #[Test]
    public function responseDataPropertyIsArray() {
        $response = new \Umserv\ExchangeInterfaces\V1\Core\Http\Response();
        $this->assertIsArray($response->data);
    }

    #[Test]
    public function responseHasMessageProperty() {
        $response = new \Umserv\ExchangeInterfaces\V1\Core\Http\Response();
        $this->assertObjectHasProperty('message', $response);
    }

    #[Test]
    public function responseMessagePropertyIsString() {
        $response = new \Umserv\ExchangeInterfaces\V1\Core\Http\Response();
        $this->assertIsString($response->message);
    }

    #[Test]
    public function responseHasCodeProperty() {
        $response = new \Umserv\ExchangeInterfaces\V1\Core\Http\Response();
        $this->assertObjectHasProperty('code', $response);
    }

    #[Test]
    public function responseCodePropertyIsInt() {
        $response = new \Umserv\ExchangeInterfaces\V1\Core\Http\Response();
        $this->assertIsInt($response->code);
    }


}